import React, { Component } from 'react';
import CommunityList from 'components/communityList/communityList'
import 'assets/styles/reset.css'
import { getCommunityList } from 'api/weifeng'
import Header from 'components/headerBar/header'
import { Route, Redirect, Switch, withRouter } from 'react-router-dom'

@withRouter
class community extends Component {
    constructor() {
        super();
        this.state = {
            list: []
        }
    }

    componentDidMount() {
        this.getCommunityListData()
    }
    async getCommunityListData() {
        let result = await getCommunityList()
        this.setState({
            list: result.data
        })

    }
    render() {
        this.showHead = this.props.history.location.pathname === '/index/community'
        return (
            <>
                {!this.showHead && <Header title="威锋社区"></Header>}
                <div style={{
                    height:'100%',
                    overflow:'scroll'
                }}>
                <CommunityList list={this.state.list}>

                </CommunityList>
                </div>
            </>

        );
    }
}

export default community;